home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Disc to the Future 2
/
Disc to the Future Part II Programmer's Reference (Wayzata Technology)(6013)(1992).bin
/
MAC
/
YERK
/
SUPPLEME
/
UNSUPPOR
/
UTILITIE
/
WORDS
< prev
Wrap
Text File
|
1986-01-24
|
7KB
|
197 lines
\ words -- sorted and a unsorted WORDS that may be echoed to the printer
\ 11/30/84 SSG Version 1.0
\ 12/17/84 SSG Moved selectors to select1; modified sortnfas:
\ 12/17/84 SSG Modified w; deleted .h and .d
\ 12/19/84 SSG Commented-out method words:
\ 12/29/84 SSG Added page: and lastPage: to WordsClass
\ 12/31/84 SSG Made theList an ordered-col in theList (mod)
\ Changed WordsClass methods to NEON words.
\ 2/17/85 SSG Made compatible with Neon release 0.95
\ 1/05/86 cdn Mode compatible with Neon release 1.5
900 ordered-col theList
30 ordered-col fileMarkers \ first NFA's of source files
: initFMarkers
clear: fileMarkers
\ NFA's of first word in each source file
' theList \ ---above---
' frontend \ frontend
' basicstr \ basicstr
' ?new \ menu
' pstartlen \ proc
' myDoc \ objInit
' thewindow \ window
' srccopy \ qd
' menubar \ event
' aboutmod \ imports
' odddp \ mod
' 2** \ ovl
' -echo \ files
' nullcfa \ struct
' dmp \ object
' ^self \ class
' inparms \ args
' \ \ base
18 0 DO nfa add: fileMarkers LOOP ;
\ ( idx -- )
: .file select{ ( source file name )
0 is{ ." nucleus" }end
1 is{ ." Base" }end
2 is{ ." Args" }end
3 is{ ." Class" }end
4 is{ ." Object" }end
5 is{ ." Struct" }end
6 is{ ." Files" }end
7 is{ ." Ovl" }end
8 is{ ." Mod" }end
9 is{ ." Imports" }end
10 is{ ." Event" }end
11 is{ ." QD" }end
12 is{ ." Window" }end
13 is{ ." objInit" }end
14 is{ ." Proc" }end
15 is{ ." Menu" }end
16 is{ ." BasicStr" }end
17 is{ ." FrontEnd" }end
18 is{ ." ---Above---" }end
}select ;
\ ( NFA -- previousNFA )
: nextNfa pfa lfa @ ;
\ Pads with blanks to field-width using current out and zeroes out.
( fldWid -- )
: padBlanks out - spaces 0 -> out ;
\ Prints name of source file which contains the word.
: .word { theNfa \ index before after -- } 0 -> after
5 spaces
size: fileMarkers dup -> index 0 \ size 0 --
DO theNfa i at: fileMarkers <
IF i -> index leave THEN
LOOP
theNfa 6 .r space
0 -> out \ Initialize system output count value.
theNfa id. $ 10 padBlanks \ 16 chars for name
index .file
$ 14 padBlanks \ 20 chars for file name
context @ -> after \ last dictionary entry
theNfa after =
IF ." last entry"
ELSE after nextNfa -> before \ previous entry
BEGIN theNfa before < WHILE
before -> after
after nextNfa -> before
REPEAT
theNfa nextNfa -> before
before id. $ 10 padblanks
after id. $ 10 padblanks
THEN
cr ;
\ Takes word from input stream and prints the name of the source file
\ that contains it.
: w initFMarkers
@pfa nfa .word ;
( 7-Sep-84 )
: d20 ( -- ) ( Usage: d20 doit ; dumps the head of doit )
[compile] ' nfa $ 20 dump ;
: d80 ( -- ) ( Usage: d80 doit ; dumps doit )
[compile] ' nfa $ 80 dump ;
( -- ) \ Lists nfa's and name strings four-across as in WORDS.
: list base >r hex cr cr
0 put out
size: [ theList ] 0
DO I at: [ theList ] dup 6 .r
dup 1+ c@
IF space id. ELSE ." Null" drop THEN
out $ 3b >
IF cr 0 put out
ELSE $ 14 out over mod - spaces
THEN
?pause
LOOP
r> put base ;
\ Prints page number and issues formfeed if 58 lines out.
: page { len -- }
len 58 /mod swap not \ 58 lines printed out?
IF cr
38 spaces ." Page" .d cr
np \ Send a form feed.
ELSE drop \ number of pages
THEN ;
\ Prints last page number and number of entries.
: lastPage { len -- }
cr cr
5 spaces ." There are" size: [ theList ] .d ." entries in the dictionary."
cr 3 ++> len
len 58 /mod 1+ \ lines-on-last-page page# --
58 rot - 0 DO cr LOOP \ Linefeed to end of page.
38 spaces ." Page" .d cr np \ Print last page number.
;
\ Compares the name strings pointed to by two NFAs.
( nfa1 nfa2 -- result )
: nfaComp count $ 1F and rot
count $ 1F and 2swap \ addr1 len1 addr2 len2 --
$= ;
( -- ) \ Puts all nfa's in dictionary into theList.
: getNfas clear: [ theList ]
last: fileMarkers pfa lfa @
BEGIN dup add: [ theList ] pfa lfa @ dup 0= UNTIL
drop ;
( -- )
: sortNfas ixaddr: [ theList ] size: [ theList ] 'c nfacomp sort ;
\ Prints names of all word and the source files that contain them
: sources { \ len -- }
initFMarkers
cr ." Sorting... Please Wait."
getnfas sortnfas
base >r hex
0 -> len +print
size: [ theList ] 0
DO i at: [ theList ] .word
1 ++> len len page
?pause
LOOP
len lastPage
r> put base -print ;
\ like list; routes output to printer.
: print { \ len -- }
base >r hex cr 5 spaces
0 put out 0 -> len
size: [ theList ] 0
DO I at: [ theList ] dup 6 .r
dup 1+ c@
IF space id. ELSE ." Null" drop THEN
out $ 3b >
IF cr 5 spaces 0 put out
1 ++> len len page
out IF 5 spaces 0 put out THEN
ELSE $ 14 out over mod - spaces
THEN
?pause
LOOP
len lastPage
r> put base ;
\ : words getnfas list ;
: aWords cr ." Sorting... Please wait." getnfas sortnfas list ;
: pWords +print getnfas print -print ;
: paWords -print cr ." Sorting... Please wait."
+print getnfas sortnfas print -print ;